package learning.maxent.training;

import learning.maxent.model.Model;
import learning.util.SparseVector;

public class MaxentParameters {

	public SparseVector[] parameters;
	
	public Model model;
	
	public void sum(MaxentParameters p, float factor) {
		for (int i=0; i < parameters.length; i++)
			parameters[i] = SparseVector.sum(parameters[i], p.parameters[i], factor);
	}
	
	public void reset() {
		if (parameters == null) {
			parameters = new SparseVector[model.numStates];
			for (int i=0; i < parameters.length; i++)
				parameters[i] = new SparseVector();
		}
			
		for (int i=0; i < parameters.length; i++)
			parameters[i].num = 0;
	}

}
